﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WCS.Infrastructure.Dto.Request.Epaylinks
{
    /// <summary>
    /// 业务开通信息
    /// </summary>
    public class EpaylinksBusinessInfo
    {
        /// <summary>
        /// 业务代码
        /// </summary>
        [Required]
        [MaxLength(32)]
        public string BusinessCode { get; set; }

        /// <summary>
        /// 业务名称
        /// </summary>
        [MaxLength(32)]
        public string? BusinessName { get; set; }

        /// <summary>
        /// 状态：0：未启用；1：已启用
        /// </summary>
        [MaxLength(4)]
        public string? State { get; set; }

        /// <summary>
        /// 如果 msg 为空，则是申请时(审核中)的业务，反之则是业务审核失败的情况。禁用的业务设为：禁用
        /// </summary>
        [MaxLength(200)]
        public string? Msg { get; set; }

        /// <summary>
        /// 手续费费率
        /// </summary>
        public List<Stage>? Stage { get; set; }

        /// <summary>
        /// 按银行计价的手续费费率
        /// </summary>
        public List<BankStage>? BankStage { get; set; }

        /// <summary>
        /// 保底手续费
        /// </summary>
        public long? FeeMin { get; set; }

        /// <summary>
        /// 封顶手续费
        /// </summary>
        public long? FeeMax { get; set; }

        /// <summary>
        /// 允许退款
        /// </summary>
        [MaxLength(2)]
        public string RefundEnabled { get; set; } = "1";

        /// <summary>
        /// 退款手续费费率
        /// </summary>
        [MaxLength(10)]
        public string RefundFeeRate { get; set; } = "0";

        /// <summary>
        /// 退款手续费单笔
        /// </summary>
        public long? RefundFeePer { get; set; } = 0;

        /// <summary>
        /// 是否允许信用卡支付
        /// </summary>
        [MaxLength(2)]
        public string CreditcardsEnabled { get; set; } = "0";

        /// <summary>
        /// 最大单笔交易金额
        /// </summary>
        public long? MaxTxsAmount { get; set; }

        /// <summary>
        /// 最小单笔交易金额
        /// </summary>
        public long? MinTxsAmount { get; set; }

        /// <summary>
        /// 结算周期
        /// </summary>
        [Required]
        [MaxLength(3)]
        public string SettleCycle { get; set; }

        /// <summary>
        /// 分账收单手续费类型
        /// </summary>
        [MaxLength(2)]
        public string? SplitOriTradeFee { get; set; }

        /// <summary>
        /// 节假日垫资费率方式
        /// </summary>
        [MaxLength(2)]
        public string? HolidayType { get; set; }

        /// <summary>
        /// D1 交易节假日附加收费的费率
        /// </summary>
        [MaxLength(10)]
        public string? HolidayRate { get; set; }

        /// <summary>
        /// D1 交易节假日附加收费的单笔加收费用
        /// </summary>
        public long? HolidayPer { get; set; }

        /// <summary>
        /// 税筹服务费类型
        /// </summary>
        [MaxLength(2)]
        public string? TaxFeeType { get; set; }

        /// <summary>
        /// 税筹服务费单笔
        /// </summary>
        public long? TaxFeePer { get; set; }

        /// <summary>
        /// 税筹服务费比例
        /// </summary>
        [MaxLength(10)]
        public string? TaxFeeRate { get; set; }

        /// <summary>
        /// 支付通道费类型
        /// </summary>
        [MaxLength(2)]
        public string? ChannelFeeType { get; set; }

        /// <summary>
        /// 支付通道费单笔
        /// </summary>
        public long? ChannelFeePer { get; set; }

        /// <summary>
        /// 支付通道费比例
        /// </summary>
        [MaxLength(10)]
        public string? ChannelFeeRate { get; set; }
    }

    /// <summary>
    /// 手续费费率阶段类
    /// </summary>
    public class Stage
    {
        /// <summary>
        /// 按比例收费
        /// </summary>
        [MaxLength(10)]
        public string? FeeRate { get; set; }

        /// <summary>
        /// 单笔收费
        /// </summary>
        public long? FeePer { get; set; }

        /// <summary>
        /// 阶梯起始交易金额
        /// </summary>
        public long? AmountFrom { get; set; } = 0;
    }

    /// <summary>
    /// 按银行计价的手续费费率类
    /// </summary>
    public class BankStage
    {
        /// <summary>
        /// 银行简码
        /// </summary>
        [Required]
        [MaxLength(32)]
        public string Bankcode { get; set; }

        /// <summary>
        /// 按比例收费
        /// </summary>
        [MaxLength(10)]
        public string? FeeRate { get; set; }

        /// <summary>
        /// 单笔收费
        /// </summary>
        public long? FeePer { get; set; }
    }
}
